import { useEffect, useState } from 'react'


export default function() {
  const [show, setShow] = useState(true)
  const [count, setCount] = useState(0)
  useEffect(() => {
    // 模拟修改count的值
    setCount(123)
    console.log('one')
  }, [])

  return (
    <div>
      <h1>Page one</h1>
      {show && (
           <div>
            <p>count: {count}</p>
            <button onClick={() => setCount(count => count + 1)}>add</button>
          </div>
      )}
      <button onClick={() => setShow(show => !show)}>toggle</button>
     
    </div>
  )
}
